package com.startup.yellocar.utils;

import java.io.File;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Random;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.Namespace;
import org.jdom2.input.SAXBuilder;
import org.springframework.transaction.annotation.Transactional;

import sun.awt.ConstrainableGraphics;


public class Generator {
    Namespace ns;
	File fXmlFile;
	Document doc;

	public Generator(File fXmlFile) {
		super();
		this.fXmlFile = fXmlFile;
		ns = Namespace.getNamespace("http://www.w3.org/2001/XMLSchema");
		try {
			SAXBuilder builder = new SAXBuilder();
			 doc = (Document) builder.build(fXmlFile);
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
	
	

	
	public static void main(String[] args)
	{
		File file = new File("D:\\DIFFO\\Personnel\\Projects\\YelloCar\\sources\\yellocarserver\\src\\main\\java\\com\\startup\\yellocar\\dto\\dto1.xsd");
		Generator dg = new Generator(file);
		DAOGenerator g1 = new DAOGenerator(dg.doc, dg.ns);
		ServiceITFGenerator g2 = new ServiceITFGenerator(dg.doc, dg.ns);
		ServiceGenerator g3 = new ServiceGenerator(dg.doc, dg.ns);
		TestGenerator g4 = new TestGenerator(dg.doc, dg.ns,"com.startup.yellocar.dto");

		

		//g1.generate();
		//g2.generate();
		g3.generate();

		
		
		
	}
	
	
}
